<?php 
$title =  mysql_real_escape_string($_POST['title']);
$content = mysql_real_escape_string($_POST['maincont']);
$key = mysql_real_escape_string($_POST['key']);

if(isset($_POST['updateseo']))

{
mysql_query("UPDATE seo  SET `meta_title` = '$title',`meta_content`='$content',`meta_keywords`='$key',
			`modified_datetime`=now() where id='".$_POST['hid']."'")
or 
die(mysql_error());

	
	echo "<script>window.location='index.php?tc=seo&_s=1'</script>";
	
}
?>
<?php if($_REQUEST['_s'] == 1){ ?>
    <div class="sucmsg"><img src="images/information.png" align="absmiddle" />&nbsp;Successfully saved.</div>
<?php } ?>
<?php if($_REQUEST['_e'] == 1){ ?>
    <div class="sucmsg"><img src="images/error.png" align="absmiddle" />&nbsp;</div>
<?php } ?>
<?php 

 $ssql="select * from seo";
$ssql=mysql_query($ssql);
$row =mysql_fetch_array($ssql);
?>
<form name="up" action="#" method="post" onSubmit="return validate()">
<table width="99%" align="center" border="0"  class="list" cellpadding="5">
<input type="hidden" name="hid" value="<?php echo  $row['id'];?>" />
<thead>
<tr>
	<td colspan="2" align="left">
        <div style="float:left" class="righthead">SEO Settings</div>
        
    </td>
</tr>
</thead>
<tr>

    <td align="left"  valign="top" width="20%">
    	Meta Title</td>
        <td><textarea name="title" id="title" style="width:462px; " ><?php echo $row['meta_title'];?></textarea>
  

    </td>
</tr>
<tr>

    <td align="left"  valign="top" width="20%">
    	Meta Content</td>
        <td>
     <textarea name="maincont" id="maincont" class="textarea" cols="55" rows="7"><?php echo $row['meta_content'];?></textarea>

    </td>
</tr>
<tr>

    <td align="left"  valign="top" width="20%">
    	Meta keywords </td>
        <td><textarea name="key" id="key" style="width:464px; " ><?php echo $row['meta_keywords'];?></textarea>
  

    </td>
</tr>
<tr>
	<td colspan="2" style="padding-left:195px;">
    	
          <input type="submit" value="Update" name="updateseo" >
         
        
    </td>
</tr>        
</table>   
</form> 
